home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Developer Connection Student Program
/
ADC Tools Sampler CD Disk 3 1999.iso
/
Cool Demos, SDKs, & Tools
/
Demos⁄Tools⁄Offers
/
Eiffel for CW beta 3
/
EiffelS2
/
LIBRARY
/
MOTEL
/
Menus.c
< prev
next >
Wrap
Text File
|
1999-05-22
|
3KB
|
126 lines
/*------------------------------------------------------------------*/
/* Eiffel/S II MacOS Runtime */
/*------------------------------------------------------------------*/
/* Author : Ian Joyner */
/* Release : 1.0 */
/* Date : Dec. 1997 */
/* Copyright : Ian Joyner */
/*------------------------------------------------------------------*/
/********************************************************************/
/* */
/* MENUs */
/* */
/********************************************************************/
#include <Menus.h>
#include <Eiffel2.h>
#include "MOTEL.h"
INTEGER platform_menu_size ()
{
MenuInfo m;
return (sizeof (m));
}
POINTER platform_menu_new (INTEGER menu_id, ConstStr255Param title)
{
Str255 scratch;
strcpy (scratch, title);
c2pstr ((char *)scratch); /* This might not be right if string is loaded from a resource */
return ((POINTER)NewMenu (menu_id, scratch));
}
POINTER platform_menu_get (INTEGER resource_id)
{
return ((POINTER)GetMenu (resource_id));
}
POINTER platform_menu_get_handle (INTEGER menu_id)
{
return ((POINTER)GetMenuHandle (menu_id));
}
INTEGER platform_menu_id (MenuHandle mh)
{
return (*mh)->menuID;
}
INTEGER platform_menu_width (MenuHandle mh)
{
return (*mh)->menuWidth;
}
INTEGER platform_menu_height (MenuHandle mh)
{
return (*mh)->menuHeight;
}
POINTER platform_menu_procedure (MenuHandle mh)
{
return (POINTER)(*mh)->menuProc;
}
INTEGER platform_menu_flags (MenuHandle mh)
{
return (*mh)->enableFlags;
}
POINTER platform_menu_data (MenuHandle mh)
{
return (POINTER)(*mh)->menuData;
}
void platform_res_menu_append (MenuHandle mh, ConstStr255Param res_type)
{
union
{
ResType r;
char c [4];
} rt;
rt.c [0] = res_type [0]; rt.c [1] = res_type [1]; rt.c [2] = res_type [2]; rt.c [3] = res_type [3];
AppendResMenu (mh, rt.r);
}
void platform_res_menu_insert (MenuHandle mh, ConstStr255Param res_type, INTEGER after)
{
union
{
ResType r;
char c [4];
} rt;
rt.c [0] = res_type [0]; rt.c [1] = res_type [1]; rt.c [2] = res_type [2]; rt.c [3] = res_type [3];
InsertResMenu (mh, rt.r, after);
}
POINTER platform_menu_get_item_text (MenuHandle mh, INTEGER item)
{
GetMenuItemText (mh, item, scratch_string);
p2cstr ((char *)scratch_string);
return &scratch_string;
}
void platform_menu_set_item_text (MenuHandle mh, INTEGER item, POINTER text)
{
Str255 scratch;
strcpy (scratch, text);
c2pstr ((char *)scratch); /* This might not be right if string is loaded from a resource */
SetMenuItemText (mh, item, scratch);
}
void platform_menu_set_item_menu (MenuHandle mh, INTEGER item, INTEGER menu)
{
SetItemCmd (mh, item, 27);
SetItemMark (mh, item, menu);
}